/*平台驱动*/

#include <linux/platform_device.h>
#include <linux/init.h>
#include <linux/module.h>

/*定义系统调用接口*/
static int led_probe(struct platform_device *pdev)
{
	printk("<kernel>call function:%s\n",__FUNCTION__);
	return 0;
}

static int led_remove(struct platform_device *pdev)
{
	printk("<kernel>call function:%s\n",__FUNCTION__);
	return 0;
}


/*全局变量*/
//定
struct rk3399_led 
{
	unsigned int major ;
	struct device *dev;
	struct class *cls;
	int gpio_led_stat; //保存引脚号
	int value; //接收用户空间的数据
};


static const struct platform_device_id led_plat_match[] = 
{
	{ "rk3399_led", 0x1 }, 
	{ "rk3288_led", 0x2 }, 
	{ "rk3568_led", 0x3 },
};


//定义平台驱动对象			
static struct platform_driver rk_led_driver = 
{
	.probe		= led_probe,
	.remove		= led_remove,
	.driver		= {
		.name	= "rk_led", //平台驱动的名称
	},
	.id_table = led_plat_match, //让驱动匹配多个设备
};


/*入口函数*/
static int __init driver_mod_init(void)
{
	printk("<kernel>call function:%s\n",__FUNCTION__);
	return platform_driver_register(&rk_led_driver);
}

/*出口函数*/
static void __exit driver_mod_exit(void)
{
	printk("<kernel>call function:%s\n",__FUNCTION__);
	platform_driver_unregister(&rk_led_driver);
}

module_init(driver_mod_init);
module_exit(driver_mod_exit);
MODULE_LICENSE("GPL");


